cmake_minimum_required(VERSION 3.10)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_VERBOSE_MAKEFILE ON)

set(THREADS_PREFER_PTHREAD_FLAG ON)

find_package(Threads REQUIRED)
find_package(benchmark REQUIRED)

set(UTILS "../utils/dbutils.hpp" "../utils/kvutils.hpp" "../utils/logutils.hpp" "../utils/transutils.hpp" "../utils/timeutils.hpp" "../utils/testutils.hpp") 
set(API "../api/receipt.hpp" "../api/user.hpp" "../api/chart.hpp" "../api/distribution.hpp" "../api/donor.hpp" "../api/donee.hpp" "../api/warehouse.hpp")


add_executable(app_test "test.cpp" ${UTILS} ${API})
add_executable(app_bench "bench.cpp" ${UTILS} ${API})

target_include_directories(app_test PRIVATE "../")
target_include_directories(app_bench PRIVATE "../")

target_link_libraries(app_test PRIVATE benchmark::benchmark Threads::Threads sqlite3 leveldb snappy gtest)
target_link_libraries(app_bench PRIVATE benchmark::benchmark Threads::Threads sqlite3 leveldb snappy gtest)

install(TARGETS app_test DESTINATION bin)
install(TARGETS app_bench DESTINATION bin)